home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-14 | 3.0 KB | 84 lines | [TEXT/R*ch] |
- // ===========================================================================
- // File: CPullAppToFront.cp
- // Version: 1.0 - May 7, 1996
- // Author: Mike Shields (mshields@inconnect.com)
- //
- // Copyright ©1996 Mike Shields. All rights reserved.
- // I hereby grant users of CPullAppToFront permission to use it (or any modified
- // version of it) in applications (or any other type of Macintosh software
- // like extensions -- freeware, shareware, commercial, or other) for free,
- // subject to the terms that:
- //
- // (1) This agreement is non-exclusive.
- //
- // (2) I, Mike Shields, retain the copyright to the original source code.
- //
- // These two items are the only required conditions for use. However, I do have
- // an additional request. Note, however, that this is only a request, and
- // that it is not a required condition for use of this code.
- //
- // (1) That I be given credit for CPullAppToFront code in the copyrights or
- // acknowledgements section of your manual or other appropriate documentation.
- //
- //
- // I would like to repeat that this last item is only a request. You are prefectly
- // free to choose not to do any or all of them.
- //
- // This source code is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- // ===========================================================================
- // CPullAppToFront.h <- double-click + Command-D to see class declaration
- //
- // LPeriodical derived class which will make the application the frontmost
- // app when it executes. It will then delete itself.
-
- #include "CPullAppToFront.h"
-
- #ifndef __PROCESSES__
- #include <Processes.h>
- #endif
-
- //---------------------------------------------------------------------------
- // CPullAppToFront::CPullAppToFront
- //---------------------------------------------------------------------------
- // Default constructor
- CPullAppToFront::CPullAppToFront()
- {
- }
-
-
- //---------------------------------------------------------------------------
- // CPullAppToFront::~CPullAppToFront
- //---------------------------------------------------------------------------
- // Destructor
- CPullAppToFront::~CPullAppToFront()
- {
- }
-
- //---------------------------------------------------------------------------
- // CPullAppToFront::SpendTime
- //---------------------------------------------------------------------------
- // Execute our periodical action (which is to delete ourselves)!
- void CPullAppToFront::SpendTime(const EventRecord &inMacEvent)
- {
- StopRepeating();
-
- ProcessSerialNumber currentPSN;
- if ( ::GetCurrentProcess(¤tPSN) == noErr )
- ::SetFrontProcess(¤tPSN);
-
- SpendTimeSelf(inMacEvent);
-
- delete this;
- }
-
- //---------------------------------------------------------------------------
- // CPullAppToFront::DoIt
- //---------------------------------------------------------------------------
- // Execute our periodical action (which is to delete ourselves)!
- void CPullAppToFront::SpendTimeSelf(const EventRecord &/*inMacEvent*/)
- {
- }
-
-